import typer
import sys

sys.path.append("../")  # noqa
from bson import ObjectId

from task_utils.task_institution import task_accumulate_metric

from config import col_activity, col_alumni, col_institution

app = typer.Typer()


@app.command()
def inst_acc():
    """es 累计组织活动 累计联系人次 累计的人数"""

    for inst in col_institution.find({"is_deleted": {"$ne": True}, "level": {"$in": [0, 1]}}).distinct("_id"):
        inst_id = ObjectId(inst)
        task_accumulate_metric(inst_id, sync=True)



if __name__ == "__main__":
    app()
